﻿using Microsoft.EntityFrameworkCore;

namespace BlazorServerCRUD.Data;
public class ApplicationDbContext:DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseInMemoryDatabase("db");
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<User>().HasData(new User
        {
            Id = 1,
            Name = "张三",
            Email = "zhang.san@qq.com"
        }, new User
        {
            Id = 2,
            Name = "李四",
            Email = "li.si@qq.com"
        }, new User
        {
            Id = 3,
            Name = "王五",
            Email = "wang.wu@qq.com"
        });
    }

    public DbSet<User> Users { get; set; }
}
